package unclassified.simple;

public class WaterBottles_1518 {
    public int numWaterBottles(int numBottles, int numExchange) {
        int ans = numBottles;
        while (numBottles > 0 && numBottles >= numExchange) {
            ans += numBottles / numExchange;
            numBottles = numBottles / numExchange + numBottles % numExchange;
        }
        return ans;
    }

    public static void main(String[] args) {
        WaterBottles_1518 wb = new WaterBottles_1518();
        System.out.println(wb.numWaterBottles(5, 5));
    }
}
